package com.baibei.module;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;

import com.baibei.basic.IPresenter;

/**
 * 单个Fragment Activity
 * Created by ChenRui on 2017/8/1 0001 19:25.
 */
public abstract class BasicFragmentActivity extends BasicActivity {


    protected Fragment mFragment;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        mFragment = onCreateFragment();
        getSupportFragmentManager().beginTransaction().add(R.id.content, mFragment).commit();
    }

    @Override
    public IPresenter getBasicPresenter() {
        return null;
    }

    protected abstract Fragment onCreateFragment();

    public int getLayoutId() {
        return R.layout.activity_single_fragment;
    }
}
